package xyz.iguilty.documents.excel.view;

import org.springframework.web.servlet.view.AbstractTemplateViewResolver;
import xyz.iguilty.documents.starter.ExcelProperties;


public class ExcelTemplateViewResolver extends AbstractTemplateViewResolver {

    public ExcelTemplateViewResolver() {
        this.setViewClass(requiredViewClass());
    }

    public ExcelTemplateViewResolver(String prefix, String suffix) {
        this();
        this.setPrefix(prefix);
        this.setSuffix(suffix);
    }

    public ExcelTemplateViewResolver(ExcelProperties excelProperties) {
        this();
        this.setPrefix(excelProperties.getPrefix());
        this.setSuffix(excelProperties.getSuffix()==null?".xls":excelProperties.getSuffix());
    }

    @Override
    protected Class<?> requiredViewClass() {
        return ExcelTemplateView.class;
    }

}
